package com.example.dbpage

import android.app.Application
import android.arch.lifecycle.AndroidViewModel
import android.arch.lifecycle.LiveData
import android.arch.paging.LivePagedListBuilder
import android.arch.paging.PagedList
import com.example.dbpage.bean.Users
import com.example.dbpage.tool.DaoHelp

class RViewModel(app: Application) : AndroidViewModel(app) {

    val dao = DaoHelp.get(app).userDao()

    private val PAGE_SIZE = 10

    fun getData(): LiveData<PagedList<Users>> {
        return LivePagedListBuilder(dao.getALlUser4(),
                PagedList.Config.Builder()
                        .setPageSize(PAGE_SIZE)
                        .build()).build()
    }
}